﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace TravelexForwardContract
{
    class XLog
    {
        private String m_file;

        public XLog()
        {
            m_file = "c:\\log.txt";
        }

        public void logMsg(String msg)
        {
            FileStream fs = File.Open(m_file,FileMode.Append);
            char[] arrayChar = msg.ToCharArray();
            byte[] arrayByte = new byte[arrayChar.Length];
            for (int i = 0; i < arrayChar.Length; i++)
            {
                arrayByte[i] = (byte)arrayChar[i];
            }
            fs.Write(arrayByte, 0, arrayByte.Length);
            fs.Close();
        }

        public void deleteLog()
        {
            if (File.Exists(m_file))
            {
                File.Delete(m_file);
                FileStream fs = File.Create(m_file);
                fs.Close();
            }
        }
    }
}
